﻿using System.Globalization;

namespace CardPlay.Tests.Common
{
    public static class ExtensionsToString
    {
        public static string ToMemberName(this string text)
        {
            var separators = new[] {' ', ','};

            return text.IndexOfAny(separators) == -1 
                ? text
                : string.Join(string.Empty, text.ToTitleCase().Split(separators));
        }

        public static string ToTitleCase(this string text)
        {
            return CultureInfo.CurrentCulture.TextInfo.ToTitleCase(text);
        }
    }
}